<?php
require_once '../sub/init.php';
if(!is_mobile())header("Location: ".Href('article'));
require_once ZEAI.'sub/conn.php';
$nodatatips = "<div class='nodatatips'><i class='ico'>&#xe608;</i>暂时木有内容</div>";
if($submitok == 'ajax_get_list')exit(get_list($kindid));
$headertitle = (!empty($kindtitle))?$kindtitle.'-'.$_ZEAI['siteName']:'婚恋学堂-'.$_ZEAI['siteName'];$nav='index';?>
<!doctype html><html><head><meta charset="utf-8">
<title><?php echo $headertitle;?></title>
<?php echo HEADMETA; ?>
<meta name="x5-orientation" content="portrait">
<link href="<?php echo RES;?>m/css/m.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<script src="<?php echo RES;?>www_zeai_cn.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/m.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<link href="<?php echo RES;?>m/css/article.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="<?php echo HOST;?>/cache/zeaicolor.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<style>
#backtop a{color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.topnav_more1{background-image:url("<?php echo RES;?>m/img/my_bg.png");background-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.topnav_more ul a.ed:after{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.topnav_more1 ul a.ed:after{background-color:#fff}
.izt .iztbox ul a.ed{box-shadow:0 .3rem .5rem 0 rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.2);background:-webkit-linear-gradient(170deg,rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.6) 0%,<?php echo $_ZEAI['mob_mbcolor'];?> 100%);background-color:#fff}
</style>
</head>
<body>
<?php if ($_ZEAI['m_mb']==2){$nav='article';$TRnav_btn = 'hide';$mainstyle=' style="margin-top:0"';require_once ZEAI.'m/top2.php';
	$rt=$db->query("SELECT id,title FROM ".__TBL_NEWS_KIND__." WHERE id>1 ORDER BY px DESC,id DESC");
	$total = $db->num_rows($rt);
	if ($total > 0) {?>
		<div class="izt">
			<div class="iztbox"><ul id="wzul">
			<?php
			$clss1=(!ifint($kind))?' class="ed" ':'';
			echo '<a href="'.mHref('article').'" '.$clss1.'>最新</a>';
			for($i=1;$i<=$total;$i++) {
				$rows = $db->fetch_array($rt,'num');
				if(!$rows) break;
				$kindid   = $rows[0];
				$kindtitle=dataIO($rows[1],'out');
				$clss=($kindid==$kind)?' class="ed"':'';
				$url=HOST.'/m/article.php?n2='.$i.'&kind='.$kindid;
				echo '<a href="'.$url.'"'.$clss.'>'.$kindtitle.'</a>';
			}?>
			</ul></div>
		</div><?php
	}
}else{ ?>
<div class="topnav_more<?php echo ($_ZEAI['m_mb']==1)?' topnav_more1':'';?>">
    <ul>
    <?php 
    $rt2=$db->query("SELECT id,title FROM ".__TBL_NEWS_KIND__." WHERE id>1 ORDER BY px DESC,id DESC");
    $total2 = $db->num_rows($rt2);
    if ($total2 > 0) {
        $clss1=(!ifint($kind))?' class="ed" ':'';
        echo '<a href="'.mHref('article').'" '.$clss1.'>最新</a>';
        for($j=0;$j<$total2;$j++) {
            $rows2 = $db->fetch_array($rt2,'num');
            if(!$rows2) break;
            $kindid   = $rows2[0];
            $kindtitle=dataIO($rows2[1],'out');
            $clss=($kindid==$kind)?' class="ed"':'';?>
           <a href="article.php?kind=<?php echo $kindid;?>&kindtitle=<?php echo $kindtitle;?>"<?php echo $clss;?>><?php echo $kindtitle;?></a><?php
        }
    }?>
    </ul>
</div>
<?php }?>
<div class="articlelist" id="articlelist"<?php echo $mainstyle;?>><?php echo get_list($kind);?></div>
<div id="backtop"><a href="#top" id="btmTopBtn"><i class="ico">&#xe60c;</i>顶部</a></div>
<script>
var ifbbs=0,ifpay=0;
function get_list(kindid){
	zeai.listEach(zeai.tag(articlekindbox,'a'),function(obj){
		obj.removeClass('ed');
	});
	o('kind'+kindid).class('ed');
	zeai.ajax({url:MHOST+'/article'+zeai.extname,data:{submitok:'ajax_get_list',kindid:kindid}},function(e){
		articlelist.html(e);
	});
}
</script>
<?php
if (is_weixin()){
	require_once ZEAI."api/weixin/jssdk.php";?>
	<script src="<?php echo RES ?>jweixin-1.2.0.js"></script>
    <script>
	var share_article_title = '婚恋学堂 - <?php echo dataIO($_ZEAI['siteName'],'out'); ?>';
	var share_article_desc  = '从相亲开始相爱——学习相亲与恋爱知识,解决爱情与婚姻烦恼,树立正确婚恋观,开启幸福生活第一步';
	var share_article_link  = '<?php echo wHref('article'); ?>';
	var share_article_imgurl= '<?php echo UP.$_ZEAI['logo']; ?>';
	wx.ready(function () {
		wx.onMenuShareAppMessage({title:share_article_title,desc:share_article_desc,link:share_article_link,imgUrl:share_article_imgurl});
		wx.onMenuShareTimeline({title:share_article_title,link:share_article_link,imgUrl:share_article_imgurl});
	});
    </script>
<?php }?>
<script src="<?php echo RES;?>m/js/article.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<?php
if($_ZEAI['m_mb']==2){
	echo "<script>setTimeout(function(){hdnavLRmoveFn(hdnav,180,'r');},100);";
	
	if($n2>=3)echo "setTimeout(function(){hdnavLRmoveFn(wzul,180,'r');},10);";
	echo "</script>";
	require_once ZEAI.'m/TRnav.php';
	require_once ZEAI.'m/bottom2.php';
}else{
	require_once ZEAI.'m/bottom.php';
}
function get_list($kindid) {
	global $db,$_ZEAI,$nodatatips;
	$SQL = (ifint($kindid))?" AND kind=".$kindid:'';
	$rt2=$db->query("SELECT id,title,kindtitle,path_s,addtime FROM ".__TBL_NEWS__." WHERE flag=1 AND kind>1 AND id>2  ".$SQL." ORDER BY px DESC,id DESC LIMIT 100");
	$total2 = $db->num_rows($rt2);
	if ($total2 > 0) {
		for($j=0;$j<$total2;$j++) {
			$rows2 = $db->fetch_array($rt2,'name');
			if(!$rows2) break;
			$id   = $rows2['id'];
			$title=dataIO($rows2['title'],'out');
			$title = gylsubstr($title,38,0,"utf-8",true);
			$path_s    = $rows2['path_s'];
			$addtime   = YmdHis($rows2['addtime'],'Ymd');
			$kindtitle = dataIO($rows2['kindtitle'],'out');
			$path_s_url= (!empty($path_s))?UP.$path_s:RES.'noP.gif';
			$echo .= '<a href="'. mHref('article',$id).'">';
			$echo .= '<img src="'.$path_s_url.'">';
			$echo .= '<em>';
			$echo .= '<h4>'.$title.'</h4>';
			$echo .= '<span>'.$kindtitle.'</span><font>'.$addtime.'</font>';
			$echo .= '</em>';
			$echo .= '<div class="clear"></div></a>';
		}
		return $echo;
	}else{
		return $nodatatips;
	}
}
?>